import React from 'react'
import { Button } from 'react-native-elements'
import FontAwesome from 'react-native-vector-icons/FontAwesome'
import { pxPage, globalColor, throttle } from '../common/Common'

const ClearInput = ({ todoinput, context, func }) => {
    return (
        <>
            {
                context !== ''
                    ? <Button
                        buttonStyle={{ backgroundColor: null }}
                        icon={
                            <FontAwesome name="remove" size={pxPage(20)} color={globalColor.defaultFontColor}></FontAwesome>
                        }
                        onPress={throttle(() => {
                            todoinput.current.clear();
                            func('')
                        }, 2000)}
                    ></Button>
                    : null
            }
        </>
    )
}

export default ClearInput
